import { createRouter, createWebHashHistory } from 'vue-router'
import Home from "../components/Home.vue"

const routes = [{
    path: '/',
    name: 'home',
    component: Home,
    meta: {
        title: '首页'
    },
    redirect: "welcome",
    children: [{
            path: 'welcome',
            name: 'Welcome',
            component: () =>
                import ("../views/Welcome.vue")
        },
        {
            path: 'user',
            name: 'User',
            meta: {
                title: '用户管理页'
            },
            component: () =>
                import ("../views/User.vue")
        },
        {
            path: 'menu',
            name: 'Menu',
            meta: {
                title: '菜单管理页'
            },
            component: () =>
                import ("../views/Menu.vue")
        },
        {
            path: 'role',
            name: 'Role',
            meta: {
                title: '角色管理页'
            },
            component: () =>
                import ("../views/Role.vue")
        }, {
            path: 'dept',
            name: 'Dept',
            meta: {
                title: '部门管理页'
            },
            component: () =>
                import ("../views/Dept.vue")
        }
    ],

}, {
    path: '/login',
    name: 'Login',
    component: () =>
        import ("../views/Login.vue")
}, ]

const router = createRouter({
    history: createWebHashHistory(),
    routes
})

export default router